<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.syzg.base.login.model.LoginObject" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.syzg.base.merge.model.Module" %>
<%@ page import="com.syzg.common.config.SysProperties" %>
<%@ page import="com.syzg.base.module.service.ModuleService" %>
<%@ page import="com.zenithsun.common.review.service.ReviewService" %>
<%@ page import="com.syzg.common.util.SpringUtil" %>
<%@page import="com.syzg.base.merge.model.TaskTreeNode"%>
<%@taglib prefix="h" uri="/syzg-html"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	request.setAttribute("ctx", request.getContextPath());
	LoginObject loginObject = (LoginObject)session.getAttribute(SysProperties.LOGIN_OBJECT);
	request.setAttribute("defaultPassword", loginObject.isDefaultPassword());
	if(loginObject.isDefaultPassword()){
		request.setAttribute("indexPage","/path/person/toUpdatePassword");
	}else{
		request.setAttribute("indexPage","/base/jsp/welcome.jsp");
	}
	String personName = loginObject.getPersonName();
	List<Module> moduleList = new ArrayList();
	
	List<Module> allModuleList = null;
	if(session.getAttribute(SysProperties.PERSON_MODULE_LIST) != null) {
		allModuleList = (List<Module>)session.getAttribute(SysProperties.PERSON_MODULE_LIST);
	}
	
	ModuleService moduleService = (ModuleService)SpringUtil.getBean("moduleService");
	TaskTreeNode taskTreeNode = moduleService.convertToTree(allModuleList);
	request.setAttribute("treeData", taskTreeNode);
	
	
	request.setAttribute("systemType", session.getAttribute("SYSTEM_TYPE").toString());
%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>南网图片库后台管理系统</title>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <link rel="stylesheet" href="${ctx}/baseNew/bootstrap/css/bootstrap.min.css">
  <link rel="stylesheet" href="${ctx}/baseNew/other/css/font-awesome.min.css">
  <link rel="stylesheet" href="${ctx}/baseNew/other/css/ionicons.min.css">
  <link rel="stylesheet" href="${ctx}/baseNew/dist/css/AdminLTE.min.css">
  <link rel="stylesheet" href="${ctx}/baseNew/dist/css/skins/_all-skins.min.css">
  <link rel="stylesheet" href="${ctx}/zenithsun/css/basic.css?109" />
  <link rel="stylesheet" href="${ctx }/zenithsun/news/pc/css/message.css" >

  <script src="${ctx}/zenithsun/js/jquery-1.9.1.min.js"></script>
  
  <script src="${ctx}/baseNew/bootstrap/js/bootstrap.min.js"></script>
  <script src="${ctx}/baseNew/other/js/bootbox.min.js" type="text/javascript"></script>
  <script src="${ctx}/baseNew/dist/js/app.min.js"></script>
  
  <!--[if lt IE 9]>
  <script src="${ctx}/baseNew/bootstrap/js/html5shiv.min.js"></script>
  <script src="${ctx}/baseNew/bootstrap/js/respond.min.js"></script>
<![endif]-->

</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
  <header class="main-header">
    <a href="javascript:void(0);" class="logo">
      <span class="logo-mini"><img alt="" src="${ctx}/zenithsun/images/logo.png" /></span>
      <span class="logo-lg"><img alt="" src="${ctx}/zenithsun/images/logo.png" /></span>
    </a>
    <nav class="navbar navbar-static-top">
      <h2 class="navTitle" title="南网传媒图片库系统">南网传媒图片库系统</h2>
      <a href="#" class="sidebar-toggle l-topSide-btn" data-toggle="offcanvas" role="button">
        <span class="sr-only"></span>
      </a>
      <div class="mod-header-right"> 
        <div class="dropdown">
         <c:if test="${systemType eq 'PIC' }">
	        <a href="javascript:;" onclick="gotoUrl('/path/picReview/toListReview');">
		        <span class="l-bell">
			        <em id="reviewCounter" style="display:none"></em>
		        </span>
	        </a>
         </c:if>
        <c:if test="${systemType ne 'PIC' }">
	        <a href="javascript:;" onclick="gotoUrl('/path/newsReview/reviewMain');">
		        <span class="l-bell">
			        <em id="reviewCounter" style="display:none"></em>
		        </span>
	        </a>
        </c:if>
        <%-- <div class="dropdown-content">
        <span></span>
        <a href="javascript:;" onclick="gotoUrl('/path/picReview/toListReview');"><span class="l-user" >未审核图片(<em id="picReviewCounter"><%=picReviewCounter%></em>)</span></a>
        <a href="javascript:;" onclick="gotoUrl('/path/newsReview/reviewMain');"><span class="l-user" >未审核新闻(<em id="newsReviewCounter"><%=newsReviewCounter%></em>)</span></a>
        </div> --%>
        </div> 
      	<span class="l-user" style="display:inline;"><%=loginObject.getPersonName() %> , 欢迎您！</span>
      	&nbsp;&nbsp;
      	<a href="javascript:openLink();">修改密码</a>
      	&nbsp;&nbsp;&nbsp;&nbsp;
      	<a class="mod-logout" href="javascript:logout();" title="点击退出系统"><span class="glyphicon glyphicon-off" ></span></a>
       </div>
    </nav>
    
  </header>
  <aside class="main-sidebar">
    <section class="sidebar">
      <ul class="sidebar-menu">
        <h:tree value="treeData" tailClass="fa fa-angle-left pull-right" methodName="gotoUrl" parentNodeClass="treeview-menu"/>
      </ul>
    </section>
  </aside>
  <div class="content-wrapper">
    <iframe id="fr" src="${ctx}${indexPage}" frameBorder=0 scrolling=yes width="100%" height="100%" onload="Javascript:SetWinHeight(this)">111</iframe>
  </div>
</div>
<script type="text/javascript">
   	
   	function gotoUrl(url){
	   	if(url==''||url=='#'){
	   		bootbox.alert("<h4>该页面正在开发中，敬请稍后......</h4>", function(){ return; });
	   	}else{
   			var defaultPassword = ${defaultPassword};
   			if(defaultPassword){
   				//如果使用默认密码，强制修改密码
   				url = '/path/person/toUpdatePassword';
   			}
   			$("#fr",parent.document.body).attr("src","${ctx}" + url);
   			//$(".content-wrapper").load("${ctx}" + url,{},function(){});
   		}
   	}
   	function SetWinHeight(){
   		var mainheight = window.screen.availHeight-122;
   		$("#fr",parent.document.body).height(mainheight);
   	}
   	
   	$(function(){
   		//左边栏子栏目添加当前状态
   		$(".treeview-menu").find("a").on('click',function(){
   			$(".treeview-menu").find("a").removeClass("on");
   			$(this).addClass("on");
   		});
   		reflashReviewCounter();
   	});
   	
   	function reflashReviewCounter(){
   	       $.ajax({
   	    	   url : "${ctx}/path/review/getAduitCount",
   	    	   type : "post",
   	    	   success:function(data){
   	    		   if(parseInt(data) > 0)
   	    		   {
   	    		   		$("#reviewCounter").removeAttr("style");
   	    		   }
   	    		   $("#reviewCounter").html(data);
   	    	   }
   	       });
   	}
   	function logout(){
   		if(confirm("确认退出？"))
   		{
   			location.href="${ctx}/logout";
   		}
   	}
   	function openLink(){
   		var url = '${ctx}/path/person/toUpdatePassword';
   		$("#fr",parent.document.body).attr("src", url);
   	}
</script>
</body>
</html>
